package com.dragon.shop.order.fegin;

import com.dragon.shop.bean.Product;
import com.dragon.shop.order.fegin.fallback.ProductServiceFallBack;
import com.dragon.shop.utils.resp.ResponseEntity;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;

/**
 * @author: Dragon
 * @since: 2023/11/12 14:20
 */
@FeignClient(value = "server-product", fallback = ProductServiceFallBack.class)
public interface ProductService {

    /**
     * 获取商品信息
     * @param pid
     * @return
     */
    @GetMapping(value = "/product/get/{pid}")
    Product getProduct(@PathVariable("pid") Long pid);

    /**
     * 更新库存数量
     * @param pid
     * @param count
     * @return
     */
    @GetMapping(value = "/product/update_count/{pid}/{count}")
    ResponseEntity updateCount(@PathVariable("pid") Long pid, @PathVariable("count") Integer count);
}
